package demo.enumerated;

/**
 * 测试动态创建枚举
 *
 * @author sun.ye
 * @since 2020-05-07 11:05
 */

/**
 * 测试方法
 */
public class TestDynaEnum {

    public static void main(String[] args) {
//        testMy();
        testA();
    }

    private static void testMy(){
        MyDynamicEnum.addEnum(Season.class);
    }
    private static void testA(){
        System.out.println("原始数据：");
        for (Season season : Season.values()) {
            System.out.println(season);
        }
        System.out.println("-----------------------------");
        DynamicEnumUtils.addEnum(Season.class, "WINTER", new Class[] {
                java.lang.String.class, SeasonPattern.class }, new Object[] {
                "winter", SeasonPattern.SNOW });
        System.out.println("添加后的数据：");
        for (Season season : Season.values()) {
            System.out.println(season);
        }
        System.out.println("-----------------------------");
        Season season = Season.valueOf("WINTER");
        System.out.println("新添加的枚举类型可以正常使用：");
        System.out.println(season.name());
        System.out.println(season.getKey());
        System.out.println(season.getSeasonPattern());
    }
}
